﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace ApiDoc
{
    partial class ApiDocumentationManager
    {
        /// <summary>
        /// Returns the namespaceDocumentation for <paramref name="name"/>.
        /// </summary>
        /// <remarks>
        /// We don't require a namespace to actualy contain a type so
        /// we'll just always return a valid NamespaceDocumentation
        /// and never return null.
        /// <remarks>
        /// </remarks>
        /// <param name="name"></param>
        /// <returns></returns>
        public NamespaceDocumentation GetNamespaceDocumentation(string name)
        {
            // Check the cache.
            if (m_namespaces.ContainsKey(name)) {
                return m_namespaces[name];
            }

            // Cache the result.
            var ret = new NamespaceDocumentation(name, this);
            m_namespaces.Add(name, ret);

            return ret;
        }

        private Dictionary<string, NamespaceDocumentation> m_namespaces = new Dictionary<string, NamespaceDocumentation>();
    }
}
